﻿using Cms.Domain;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Cms.Tests.Unit.Domain
{

    [TestClass]
    public class ApplicationPageTests
    {

        [TestMethod]
        public void TestGetAndSetCode()
        {
            // Test code behind setter and getter
            ApplicationPage page = new ApplicationPage();
            Assert.AreEqual("", page.GetCode());
            Administrator admin = new Administrator();
            page.SetCode("some code", admin);
            Assert.AreEqual("some code", page.GetCode());
            Assert.AreEqual(1, page.SourceCode.Versions.Count);
            // Test design setter and getter
            Assert.AreEqual("", page.GetAreaDesign("area1"));
            page.SetAreaDesign("area1", "some code", admin);
            Assert.AreEqual("some code", page.GetAreaDesign("area1"));
            Assert.AreEqual(1, page.Areas["area1"].Versions.Count);
        }

    }

}
